package main;

public class MyDouble implements Comparable<MyDouble> {
	private static final double EPSILON = .0001;
	private final double v;

	public MyDouble(double x) {
		v = x;
	}

	public double doubleValue() {
		return v;
	}

	public boolean equals(Object other) {
		return Math.abs(((MyDouble)other).doubleValue() - v)<EPSILON;
	}

	public int compareTo(MyDouble other) {
		double d = v-other.doubleValue();
		if (d < 0)
			return -1;
		else if (d > 0)
			return 1;
		else
			return 0;
	}

	public String toString() {
		return Double.toString(v);
	}

}
